<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title></title>

</head>
<body onload="init()">
<canvas id="mainCanvas" width="400px" height="300px"></canvas>
<script src="//cdn.bootcss.com/three.js/r83/three.min.js"></script>
<script type="text/javascript">
        function init() {
            var renderer = new THREE.WebGLRenderer({
                canvas: document.getElementById('mainCanvas')   //渲染器将和 Canvas 元素进行绑定
            });
            renderer.setClearColor(0x000000);       // Canvas 元素背景色
            
            var scene = new THREE.Scene();      //实例化场景
            
            var camera = new THREE.OrthographicCamera(-5, 5, 3.75, -3.75, 0.1, 100);    //定义照相机 以下是属性
            camera.position.set(25, 25, 25);
            camera.lookAt(new THREE.Vector3(0, 0, 0));
            scene.add(camera);          //将照相机加到场景中

            var material = new THREE.MeshBasicMaterial({    //实例化一个材料  定义属性
                color: 0xffff00,
                wireframe: true
            });

            cube = new THREE.Mesh(new THREE.CubeGeometry(1, 2, 3, 2, 2, 3), material);      //创建一个长方形  加入材料
            scene.add(cube);                                                                //把长方形加到场景中
            
            renderer.render(scene, camera); //开始渲染
    }
</script>

</body>

</html>